Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add defrag logic for zsets #3836

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

chore: add defrag logic for zsets #3836

wants to merge 6 commits into from

Conversation

kostasrim
Copy link
Contributor

  • add defrag logic for zsets

partially resolves #3822 [2/2]

@kostasrim kostasrim changed the base branch from main to kpr4 September 30, 2024 17:15
return realloced;
}

pair<sds, bool> ScoreMap::ReallocIfNeeded(void* obj, float ratio) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can extra this to seperate function. It's almost identical as to StringMap... I will follow up on this on separate PR with a small refactor


for (auto it = score_map->begin(); it != score_map->end(); ++it) {
realloced |= it.ReallocIfNeeded(ratio);
// Not sure if it's worth going over B+ tree cause lgn to delete + lgn to insert
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I don't think it's really worth going over the B+ tree because we would need to delete + insert. We can add this in the future if we wish to + it's really boilerplate....

@@ -142,4 +142,50 @@ detail::SdsScorePair ScoreMap::iterator::BreakToPair(void* obj) {
return detail::SdsScorePair(f, GetValue(f));
}

bool ScoreMap::iterator::ReallocIfNeeded(float ratio) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also //todo for me, mock this and test for sanity

@kostasrim kostasrim self-assigned this Sep 30, 2024
Base automatically changed from kpr4 to main October 2, 2024 07:00
@kostasrim kostasrim changed the title [do not review - WIP]: chore: add defrag logic for zsets chore: add defrag logic for zsets Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement defragmentation for OBJ_ZSET and OBJ_SET
1 participant